---
title: wrof-mode 文档
tags:
  - emacs
categories:
  - 文档
layout: post
---

<div id="outline-container-orge642208" class="outline-2">
<h2 id="orge642208">Intro</h2>
<div class="outline-text-2" id="text-orge642208">
<p>
This extension works similar to <a href="http://orgmode.org/manual/Speed-keys.html">org-mode's speed keys</a>, while adding in
a bit of <i>vi</i> flavor, specifically:
</p>
</div>

<div id="outline-container-orgd21ba88" class="outline-3">
<h3 id="orgd21ba88">Modal editing</h3>
<div class="outline-text-3" id="text-orgd21ba88">
<p>
This is just what the speed keys do: pressing <kbd>a</kbd> - <kbd>z</kbd>, <kbd>A</kbd> - <kbd>Z</kbd>, or
<kbd>0</kbd> - <kbd>9</kbd> while the point is positioned as below will call a command
instead of inserting these characters:
</p>

<table><tbody><tr><td>
<div class="org-src-container">
<pre class="src src-text">||* foo
</pre>
</div>
</td><td>
<div class="org-src-container">
<pre class="src src-text">*||* bar
</pre>
</div>
</td><td>
<div class="org-src-container">
<pre class="src src-text">||#+ baz
</pre>
</div>
</td></tr></tbody></table>

<p>
As you see, the point has to be either at one of the <code>*</code> that start from
the beginning of the line or actually at the beginning of the line,
followed by <code>#+</code> which will further be referred to as markup.
</p>
</div>
</div>


<div id="outline-container-org4c11d9d" class="outline-3">
<h3 id="org4c11d9d">Nouns and verbs</h3>
<div class="outline-text-3" id="text-org4c11d9d">
<p>
It's just an intuitive way of organizing the key bindings borrowed
from vi: the commands are sentences - combinations of a verb and a
noun used together.
</p>

<p>
Similar to vi, <a href="#left"><kbd>h</kbd></a> / <a href="#down"><kbd>j</kbd></a> / <a href="#up"><kbd>k</kbd></a> / <a href="#right"><kbd>l</kbd></a> are the nouns that represent the
arrow keys. These and additional nouns are listed in the tables below.
</p>
</div>

<ul class="org-ul">
<li><a id="org4a9db9e"></a>Nouns table<br />
<div class="outline-text-4" id="text-org4a9db9e">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">


<colgroup>
<col  class="org-left" />

<col  class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">key</th>
<th scope="col" class="org-left">name</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><a href="#down"><kbd>j</kbd></a></td>
<td class="org-left">down</td>
</tr>

<tr>
<td class="org-left"><a href="#up"><kbd>k</kbd></a></td>
<td class="org-left">up</td>
</tr>

<tr>
<td class="org-left"><a href="#left"><kbd>h</kbd></a></td>
<td class="org-left">left</td>
</tr>

<tr>
<td class="org-left"><a href="#right"><kbd>l</kbd></a></td>
<td class="org-left">right</td>
</tr>

<tr>
<td class="org-left"><a href="#added"><kbd>a</kbd></a></td>
<td class="org-left">added</td>
</tr>

<tr>
<td class="org-left"><a href="#property"><kbd>p</kbd></a></td>
<td class="org-left">property</td>
</tr>

<tr>
<td class="org-left"><a href="#tags"><kbd>t</kbd></a></td>
<td class="org-left">tags</td>
</tr>
</tbody>
</table>
</div>
</li>

<li><a id="org9623f21"></a>Verbs table<br />
<div class="outline-text-4" id="text-org9623f21">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">


<colgroup>
<col  class="org-left" />

<col  class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">key</th>
<th scope="col" class="org-left">name</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><a href="#goto">none</a></td>
<td class="org-left"><i>goto</i></td>
</tr>

<tr>
<td class="org-left"><a href="#/change/"><kbd>c</kbd></a></td>
<td class="org-left"><i>change</i></td>
</tr>

<tr>
<td class="org-left"><a href="#change-tree"><kbd>cf</kbd></a></td>
<td class="org-left"><i>change tree</i></td>
</tr>

<tr>
<td class="org-left"><a href="#change-shift"><kbd>cs</kbd></a></td>
<td class="org-left"><i>change shift</i></td>
</tr>

<tr>
<td class="org-left"><a href="#keyword"><kbd>w</kbd></a></td>
<td class="org-left"><i>keyword</i></td>
</tr>

<tr>
<td class="org-left"><a href="#clock"><kbd>C</kbd></a></td>
<td class="org-left"><i>clock</i></td>
</tr>

<tr>
<td class="org-left"><a href="#delete"><kbd>d</kbd></a></td>
<td class="org-left"><i>delete</i></td>
</tr>

<tr>
<td class="org-left"><a href="#yank"><kbd>y</kbd></a></td>
<td class="org-left"><i>yank</i></td>
</tr>

<tr>
<td class="org-left"><a href="#mark"><kbd>m</kbd></a></td>
<td class="org-left"><i>mark</i></td>
</tr>
</tbody>
</table>
</div>
</li>
</ul>
</div>
</div>

<div id="outline-container-org2c991c1" class="outline-2">
<h2 id="org2c991c1">Nouns</h2>
<div class="outline-text-2" id="text-org2c991c1">
</div>
<div id="outline-container-down" class="outline-3">
<h3 id="down"><kbd>j</kbd> - down</h3>
<div class="outline-text-3" id="text-down">
<p>
Move <i>down</i> across headings and markup. Use a number prefix to move
several times at once, i.e. <kbd>2j</kbd> will move two headings down.
</p>

<p>
When you're in a heading, <kbd>j</kbd> will not enter markup, use <a href="#right"><kbd>l</kbd></a> for that
instead, as markup that belongs to a heading can be seen as being
<i>right</i> of that heading. This restriction speeds up the movement
across headings that contain a lot of markup.
</p>

<p>
When you're in markup, <kbd>j</kbd> will not enter a heading, use <a href="#left"><kbd>h</kbd></a> for that
instead, as the heading can be seen as being <i>left</i> of its markup.
This restriction allows to use a huge numeric arg (e.g. <kbd>9j</kbd> or <kbd>99j</kbd>)
to move all the way to the last markup of the heading.
</p>

<p>
The exception to both restrictions is the first markup in the file
that does not belong to any heading.
</p>
<hr />
</div>
</div>

<div id="outline-container-up" class="outline-3">
<h3 id="up"><kbd>k</kbd> - up</h3>
<div class="outline-text-3" id="text-up">
<p>
Move <i>up</i> across headings and markup. Use a number prefix to move
several times at once, i.e. <kbd>3k</kbd> will move three headings up.
</p>

<p>
Same rules as <a href="#down"><kbd>j</kbd></a> apply.
</p>
<hr />
</div>
</div>

<div id="outline-container-left" class="outline-3">
<h3 id="left"><kbd>h</kbd> - left</h3>
<div class="outline-text-3" id="text-left">
<p>
Move <i>left</i> i.e. to the parent heading of current heading or markup.
</p>

<p>
You can use it e.g. to go from fifth level 3 heading to its parent
level 2 heading, or from the second source block to the parent
heading.
</p>
<hr />
</div>
</div>

<div id="outline-container-right" class="outline-3">
<h3 id="right"><kbd>l</kbd> - right</h3>
<div class="outline-text-3" id="text-right">
<p>
Move <i>right</i> (i.e. to the first child of current heading).  You can
use it to get to the first markup of the current heading.
</p>
<hr />
</div>
</div>

<div id="outline-container-added" class="outline-3">
<h3 id="added"><kbd>a</kbd> - added</h3>
<div class="outline-text-3" id="text-added">
<p>
Represents <i>added</i> heading. The behavior depends on the currently
active verb:
</p>
</div>
<ul class="org-ul">
<li><a id="org84a4040"></a>goto<br />
<div class="outline-text-4" id="text-org84a4040">
<p>
Forward to <code>org-insert-heading-respect-content</code> (bound to <kbd>C-RET</kbd> in <code>org-mode</code>).
</p>
</div>
</li>

<li><a id="org2158cf1"></a>change<br />
<div class="outline-text-4" id="text-org2158cf1">
<p>
Forward to <code>org-meta-return</code> (bound to <kbd>M-RET</kbd> in <code>org-mode</code>).
</p>
</div>
</li>

<li><a id="org9c7224c"></a>keyword<br />
<div class="outline-text-4" id="text-org9c7224c">
<p>
Add a new heading with a corresponding keyword.
</p>

<p>
For example <kbd>wta</kbd> will add a new <b>TODO</b>, and <kbd>wna</kbd> will add a new
<b>NEXT</b>.
</p>
<hr />
</div>
</li>
</ul>
</div>

<div id="outline-container-property" class="outline-3">
<h3 id="property"><kbd>p</kbd> - property</h3>
<div class="outline-text-3" id="text-property">
<p>
Represents current heading's <i>property</i>. The behavior depends on the
currently active verb:
</p>
</div>

<ul class="org-ul">
<li><a id="org4263fe4"></a>goto<br />
<div class="outline-text-4" id="text-org4263fe4">
<p>
Move to the property, i.e. open the property drawer and place the
point on the first property.
</p>
</div>
</li>

<li><a id="orgea29ccb"></a>change<br />
<div class="outline-text-4" id="text-orgea29ccb">
<p>
Change property. This forwards to <code>org-set-property</code>, which will
prompt you for the name of the property and it's value.
</p>

<p>
You can use this to add new properties as well.
</p>
</div>
</li>

<li><a id="orgd0103f4"></a>delete<br />
<div class="outline-text-4" id="text-orgd0103f4">
<p>
Delete property. This forwards to <code>org-delete-property</code>.
</p>
<hr />
</div>
</li>
</ul>
</div>

<div id="outline-container-tags" class="outline-3">
<h3 id="tags"><kbd>t</kbd> - tags</h3>
<div class="outline-text-3" id="text-tags">
<p>
Represents current heading's <i>tags</i>.
</p>

<p>
Currently, the only meaningful sentence is <kbd>ct</kbd>, which forwards to
<code>org-set-tags</code>.
</p>
<hr />
</div>
</div>
</div>

<div id="outline-container-org8ea0636" class="outline-2">
<h2 id="org8ea0636">Verbs</h2>
<div class="outline-text-2" id="text-org8ea0636">
<p>
Some verbs, such as <a href="#/change/"><kbd>c</kbd></a> (change), or <a href="#change-tree"><kbd>cf</kbd></a> (change tree) are <i>sticky</i>: once you
activate them, they stick around until deactivated or you switch to
another sticky verb (only one can be active at a time).  Their
stickiness is represented by a change in the mode line. Each of them
can be deactivated by the same key that activated them, or universally
with <kbd>q</kbd>. Currently separate minor modes are used to implement sticky
verbs because their concept is exactly the same.
</p>

<p>
Other verbs, such as <a href="#clock"><kbd>C</kbd></a> (clock), are more like <i>vi</i> verbs, i.e. they
deactivate themselves after the first command.
</p>

<p>
And just to add to the confusion, some nouns will deactivate a verb
(e.g. <kbd>cwd</kbd>), while others won't (e.g. <kbd>cj</kbd>).
</p>
<hr />
</div>

<div id="outline-container-goto" class="outline-3">
<h3 id="goto"><i>goto</i></h3>
<div class="outline-text-3" id="text-goto">
<p>
This verb is active by default. Its effect on the nouns is to move the
point appropriately.
</p>
<hr />
</div>
</div>

<div id="outline-container-/change/" class="outline-3">
<h3 id="/change/"><kbd>c</kbd> - <i>change</i></h3>
<div class="outline-text-3" id="text-/change/">
<p>
Call <code>worf-change-mode</code>.
</p>

<p>
This is a <i>sticky</i> verb: once you press <kbd>c</kbd>, <i>change</i> verb will be
active until you switch to a different verb.
</p>

<p>
Use the same letter to deactivate a verb as to activate it, i.e. <kbd>c</kbd>
will deactivate <code>worf-change-mode</code>.  <kbd>q</kbd> will universally deactivate
any verb and return you to <i>goto</i> implicit verb.
</p>

<p>
While <code>worf-change-mode</code> is active, <kbd>hjkl</kbd> move the current heading
in appropriate directions: it's the same as holding <kbd>M-</kbd> and using
arrow keys in the default org.
</p>

<ul class="org-ul">
<li><kbd>cp</kbd> will change the selected property</li>
<li><kbd>ct</kbd> will change current tags</li>
<li><kbd>ca</kbd> will add heading above instead of below, like <kbd>a</kbd> does</li>
<li><kbd>cn</kbd> will change the name of a source block</li>
</ul>
<hr />
</div>
</div>

<div id="outline-container-change-tree" class="outline-3">
<h3 id="change-tree"><kbd>cf</kbd> - <i>change tree</i></h3>
<div class="outline-text-3" id="text-change-tree">
<p>
Call <code>worf-change-tree-mode</code>.
</p>

<p>
While <code>worf-change-tree-mode</code> is active, <kbd>hjkl</kbd> move the current
heading tree in appropriate directions: it's the same as holding
<kbd>S-M-</kbd> and using arrow keys in the default org.
</p>
</div>
</div>

<div id="outline-container-change-shift" class="outline-3">
<h3 id="change-shift"><kbd>cs</kbd> - <i>change shift</i></h3>
<div class="outline-text-3" id="text-change-shift">
<p>
Call <code>worf-change-shift-mode</code>.
</p>

<p>
While <code>worf-change-shift-mode</code> is active, <kbd>hjkl</kbd> act as
<kbd>S-</kbd> and arrows in the default org.
</p>
<hr />
</div>
</div>

<div id="outline-container-keyword" class="outline-3">
<h3 id="keyword"><kbd>w</kbd> <i>keyword</i></h3>
<div class="outline-text-3" id="text-keyword">
<p>
Call <code>worf-keyword-mode</code>.
</p>

<p>
You select a keyword e.g. <b>TODO</b> or <b>NEXT</b> and <kbd>j</kbd> / <kbd>k</kbd> move just by the
selected keyword, skipping all other headings.
</p>

<p>
Additionally, <kbd>a</kbd> will add a new heading with the appropriate keyword,
e.g. <kbd>wta</kbd> will add a new <b>TODO</b>, and <kbd>wna</kbd> will add a new <b>NEXT</b>.
</p>
<hr />
</div>
</div>

<div id="outline-container-clock" class="outline-3">
<h3 id="clock"><kbd>C</kbd> - <i>clock</i></h3>
<div class="outline-text-3" id="text-clock">
<p>
Call <code>worf-clock-mode</code>.
</p>

<p>
This one isn't sticky and has only two nouns that work with it:
</p>
<ul class="org-ul">
<li><kbd>i</kbd> (<code>org-clock-in</code>)</li>
<li><kbd>o</kbd> (<code>org-clock-out</code>)</li>
</ul>
<hr />
</div>
</div>

<div id="outline-container-delete" class="outline-3">
<h3 id="delete"><kbd>d</kbd> - <i>delete</i></h3>
<div class="outline-text-3" id="text-delete">
<p>
Call <code>worf-delete-mode</code>.
</p>

<p>
This one isn't sticky and changes the behavior of <kbd>j</kbd> to delete down,
and <kbd>k</kbd> to delete up. You can mix in numbers to delete many times,
i.e. <kbd>d3j</kbd> will delete 3 headings at once.
</p>

<ul class="org-ul">
<li><kbd>dp</kbd> will delete the selected property</li>
<li><kbd>dn</kbd> will delete the name of the current source block</li>
</ul>
<hr />
</div>
</div>

<div id="outline-container-yank" class="outline-3">
<h3 id="yank"><kbd>y</kbd> - <i>yank</i></h3>
<div class="outline-text-3" id="text-yank">
<p>
Call <code>worf-yank-mode</code>.
</p>

<p>
It's similar to <a href="#delete"><kbd>d</kbd></a>, but will copy the headings into
the kill ring instead of deleting.
</p>
<hr />
</div>
</div>

<div id="outline-container-mark" class="outline-3">
<h3 id="mark"><kbd>m</kbd> - <i>mark</i></h3>
<div class="outline-text-3" id="text-mark">
<p>
Call <code>worf-mark-mode</code>.
</p>

<p>
It's similar to <a href="#delete"><kbd>d</kbd></a>, but will mark the headings instead
of deleting.
</p>
<hr />
</div>
</div>
</div>

<div id="outline-container-orgb0b7821" class="outline-2">
<h2 id="orgb0b7821">Miscellaneous commands</h2>
<div class="outline-text-2" id="text-orgb0b7821">
<p>
Some other things included in worf, that don't fit into the
verb-noun structure, are:
</p>
</div>

<div id="outline-container-org40d9077" class="outline-3">
<h3 id="org40d9077"><kbd>[</kbd> - <code>worf-backward</code></h3>
<div class="outline-text-3" id="text-org40d9077">
<p>
Go backwards to closest special position. <kbd>]</kbd> does the same in the opposite direction.
</p>
</div>
</div>

<div id="outline-container-orgf06800d" class="outline-3">
<h3 id="orgf06800d"><kbd>i</kbd> - <code>worf-tab</code></h3>
<div class="outline-text-3" id="text-orgf06800d">
<p>
Wraps around <code>org-cycle</code>.
</p>

<p>
Additionally, e.g. <kbd>2i</kbd> will show a summary up to level 2, <kbd>3i</kbd> -
level 3 etc.
</p>
</div>
</div>

<div id="outline-container-org2980cd8" class="outline-3">
<h3 id="org2980cd8"><kbd>I</kbd> - <code>worf-shifttab</code></h3>
<div class="outline-text-3" id="text-org2980cd8">
<p>
Just a wrapper for <code>org-shifttab</code>.
</p>
</div>
</div>

<div id="outline-container-orga177f57" class="outline-3">
<h3 id="orga177f57"><kbd>o</kbd> - <code>worf-ace-link</code></h3>
<div class="outline-text-3" id="text-orga177f57">
<p>
Open a link within current heading that's visible on screen. See
<a href="https://github.com/abo-abo/ace-link">ace-link</a> for a package that uses this method in other modes.
</p>
</div>
</div>

<div id="outline-container-orgca21237" class="outline-3">
<h3 id="orgca21237"><kbd>g</kbd> - <code>worf-goto</code></h3>
<div class="outline-text-3" id="text-orgca21237">
<p>
Open a <code>helm</code> outline of the current buffer.  It's very good when you
want to search/navigate to a heading by word or level. See <a href="https://github.com/abo-abo/lispy">lispy</a> for a
package that uses this method to navigate Lisp code.
</p>
</div>
</div>

<div id="outline-container-orgb7847f5" class="outline-3">
<h3 id="orgb7847f5"><kbd>L</kbd> - <code>worf-copy-heading-id</code></h3>
<div class="outline-text-3" id="text-orgb7847f5">
<p>
Copy the link to current heading to the kill ring. This may be useful
when you want to create a lot of links.
</p>
</div>
</div>

<div id="outline-container-worf-change-time" class="outline-3">
<h3 id="worf-change-time"><kbd>cT</kbd> - el:worf-change-time</h3>
<div class="outline-text-3" id="text-worf-change-time">
<p>
Set the "current" time  for this buffer only. All timestamps inserted by el:org-todo in
this buffer will use this time.
</p>

<p>
To un-set the "current" time, press <kbd>C-g</kbd> during the selection.
</p>

<hr />
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
</div>
</div>
